-
-
Notifications
You must be signed in to change notification settings - Fork 46.6k
[UPDATED]rat_in_maze.py #9087
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[UPDATED]rat_in_maze.py #9087
Conversation
Kindly tick the checkboxes while raising PR, don't delete them. |
Ok, but now how to tick checkboxes when PR is raised? |
Replace |
Sorry, but where? |
While creating PR, you will get a box to describe the change, below in the box there are multiple checkboxes to tick. https://github.com/TheAlgorithms/Python/blob/master/.github/pull_request_template.md |
should I delete this PR now, and create another one and tick checkboxes? |
No...copy from that link which I provided, and paste it in description box above, then tick required checkboxes. |
Also revise the PR title, don't include 9066, this should be in description box, see contributing guidelines beforehand. |
Thanks a lot, your guidance meant a lot to me:) |
Co-authored-by: dlesnoff <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for the correction.
I am not familiar with the Python repository, but I think that you should reflect the changes in the unittest. |
[UPDATED] rat_in_maze.py
At line 19, a lack of a blank line after >>>: '>>>>>>> origin/new_branch' is given in error but text '>>>>>>> origin/new_branch' doesn't appear to be related to the code or docstring. I have suggested change, commit that and see if it resolves the issue or not. |
Co-authored-by: Rohan Anand <[email protected]>
|
for more information, see https://pre-commit.ci
Use |
3 errors found ,then how should I resolve them without using ruff --fix . |
run : |
still 3 errors found |
using black . showing All done but ruff . --fix showing 3 erros found |
I understand what the problem is. The output of solve_maze is a 2D array written in the docstring as [[0, 1, 1], [0, 0, 1], [0, 0, 1]], but it exceeds the 88-character word limit. Now, when I format the line, the expected output does not match the obtained output. Can you help me in how to approach this issue now? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove print statement as it is returning None.
backtracking/rat_in_maze.py
Outdated
""" | ||
size = len(maze) | ||
# Check if source and destination coordinates are Invalid. | ||
if not (0 <= source_row <= size - 1 and 0 <= source_column <= size - 1): | ||
print("Invalid source coordinates") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
print("Invalid source coordinates") | |
backtracking/rat_in_maze.py
Outdated
print("Invalid source coordinates") | ||
return None | ||
elif not (0 <= destination_row <= size - 1 and 0 <= destination_column <= size - 1): | ||
print("Invalid destination coordinates") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
print("Invalid destination coordinates") | |
backtracking/rat_in_maze.py
Outdated
if solved: | ||
print("\n".join(str(row) for row in solutions)) | ||
return solutions | ||
else: | ||
print("No solution exists!") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
print("No solution exists!") | |
Thank you for your contribution, but unfortunately we're not accepting new PRs at the moment. We're currently trying to clear our backlog of existing PRs in preparation for Hacktoberfest. If you want to contribute, please wait until after October 1 to do so. See this discussion for more info. |
The '>>>>>>>' and '======' stuff comes from the git merge. When there is a conflict (a file being changed in the two original branches),
|
Describe your change:
FIXES #9066
I have made updates to the rat_in_maze.py file to enhance code clarity.
These updates include:
1.Adding more descriptive comments to explain the logic and steps of the maze-solving algorithm.
2.Introducing variables that allow for easy customization of the source and destination cells within the maze.
3.Refactor path representation in solution:
Checklist: